<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<script src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<style type="text/css">
	#div1{
			display: none;
			color: red;
	}
	#div2{
			display: none;
			color: red;
	}
	#div3{
			display: none;
			color: red;
	}
</style>
<form action="NewsAction_insert" method="post">
	<table >
		<tr><td>title</td><td><input id="title" type="text" name="title"></td><td><div id="div1">请输入标题~~</div></td></tr>
		<tr><td>context</td><td><input id="context" type="text" name="context"></td><td><div id="div2">请输入内容~~</div></td></tr>
		<tr><td>pubtime</td><td><input id="pubtime" type="text" name="pubtime"></td><td><div id="div3">请输入发布时间~~</div></td></tr>
		<tr><td>type</td><td><input type="radio" name="type" value="八卦" checked="checked">八卦<input type="radio" name="type" value="骂人">骂人<input type="radio" name="type" value="悬疑">悬疑</td></tr>
		<tr><td>uname</td><td>
			<select name="uid">
				<c:forEach items="${list}" var="l">
					<option value="${l.uid}">${l.user.uname}</option>
				</c:forEach>
			</select>
		</td></tr>
		<tr><td><input type="submit" name="提交" onclick="return ti()"></td></tr>
	</table>
</form>
<script type="text/javascript">
	function ti(){
		$("#div1").css("display","none");
		$("#div2").css("display","none");
		$("#div3").css("display","none"); 
		var t=$('#title').val();
		var c=$('#context').val();
		var p=$('#pubtime').val();
		var ti="";
		if(t==""){
			$("#div1").css("display","block");
			t="";
			ti=false;
		}if(c==""){
			$("#div2").css("display","block");
			c="";
			ti=false;
		}if(p==""){
			$("#div3").css("display","block");
			p="";
			ti=false;
		}else{
  			ti=true;
		}
		
		
		
		
		return ti;
	}
</script>
</body>
</html>